<template>
	<view class="list">
		<view class="list-item mb-24px" v-for="(item,index) in activityList" :key="index"
			@click="toActivityCenter(item)">
			<image class="activity-img" :src="item.shareImg" mode=""></image>
			<view class="activity-title">
				{{item.name}}
			</view>
			<view class="activity-time mt-4px">
				结束时间：{{item.endTimeFormat}}
				<view class="activity-price">
					￥{{item.price}}
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		onLoad
	} from '@dcloudio/uni-app';
	import {
		ref,
		onMounted
	} from 'vue'
	import {
		activityListApi
	} from '/http/index.js';
	let activityList = ref([]);
	onMounted(() => {
		activityListFn()
	})
	let tenantType=ref(0);
	const activityListFn = () => {
		activityListApi({
			id: "",
			name: "",
			tenantType: tenantType.value,
			pageSize: 20,
			pageIndex: 1
		}).then(res => {
			activityList.value = res.items
		}).catch((err) => {})
	}
	const toActivityCenter = (item) => {
		uni.$uv.route({
			url: '/pagesPoster/Leaflet/Leaflet?id=' + item.id,
		})
	}

	onLoad((option) => {
		console.log('onLoad', option)
		tenantType.value=option.tenantType;
	})
</script>

<style lang="scss" scoped>
	.list {
		width: 100%;
		min-height: 100vh;
		padding: 30rpx 24rpx;
		box-sizing: border-box;
		background-color: #fff;

		.list-item {
			display: flex;
			flex-direction: column;
			align-items: center;
			border-radius: 10rpx;
			overflow: hidden;
			padding-bottom: 18rpx;
			box-shadow: 0 0 30rpx 0rpx #d3d3d3;

			.activity-img {
				width: 100%;
				height: 100px;
			}

			.activity-title {
				width: 100%;
				padding: 0 18rpx;
				box-sizing: border-box;
				margin-top: 10rpx;
			}

			.activity-time {
				width: 100%;
				padding: 0 18rpx;
				box-sizing: border-box;
				font-size: 24rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;

				.activity-price {
					color: #0a5fff;
				}
			}
		}
	}
</style>